//
//  LGPatientRiskCell.m
//  XieHeHeartDisease
//
//  Created by 1234 on 2024/1/26.
//

#import "LGPatientRiskCell.h"

@interface LGPatientRiskCell()

/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGPatientRiskCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.baseView];
        [self.contentView addSubview:self.contentLabel];
        [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView).offset(viewPix(5));
            make.left.equalTo(self.contentView).offset(viewPix(18));
            make.right.equalTo(self.contentView).offset(-viewPix(18));
            make.bottom.equalTo(self.contentView).offset(-viewPix(5));
        }];
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.baseView).offset(viewPix(10));
            make.left.equalTo(self.baseView).offset(viewPix(10));
            make.right.equalTo(self.baseView).offset(-viewPix(10));
            make.bottom.equalTo(self.baseView).offset(-viewPix(10));
        }];
    }
    return  self;
}

-(void)setTitle:(NSString *)title{
    _title = title;
    self.contentLabel.text = title;
}

-(void)setIsSelect:(BOOL)isSelect{
    _isSelect = isSelect;
    NSString *textColor = (isSelect == YES)?kThemeColor:@"#606266";
    NSString *boardColor = (isSelect == YES)?kThemeColor:@"#C5D3CC";
    NSString *backColor = (isSelect == YES)?@"#E3F8F2":@"#FFFFFF";
    self.contentLabel.textColor = [UIColor colorWithString:textColor];
    self.baseView.layer.borderColor = [UIColor colorWithString:boardColor].CGColor;
    self.baseView.backgroundColor = [UIColor colorWithString:backColor];
    
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [[UIView alloc] init];
        _baseView.layer.borderColor = [UIColor colorWithString:@"#C5D3CC"].CGColor;
        _baseView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
        _baseView.layer.borderWidth = 1;
        _baseView.layer.cornerRadius = 3;
    }
    return _baseView;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#606266" textFont:LGFont(15) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
